package com.niiwoo.civet.trade.service.dubbo.configure;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.trade.dao.entity.InvestFlowConfig;
import com.niiwoo.civet.trade.dto.response.InvestFlowConfigResponseDTO;
import com.niiwoo.civet.trade.enums.InvestFlowConfigTypeEnum;
import com.niiwoo.civet.trade.service.configure.InvestFlowConfigDubboService;
import com.niiwoo.civet.trade.service.local.configure.InvestFlowConfigLocalService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by zhangwanli on 2017/11/29.
 */
@Service(version = "1.0.0")
public class InvestFlowConfigDubboServiceImpl implements InvestFlowConfigDubboService {

    @Autowired
    private InvestFlowConfigLocalService flowConfigLocalService;

    @Override
    public InvestFlowConfigResponseDTO queryInvestFlowConfig(InvestFlowConfigTypeEnum type) {
        InvestFlowConfig config = flowConfigLocalService.queryByType(type);
        InvestFlowConfigResponseDTO responseDTO = null;
        if (config != null) {
            responseDTO = new InvestFlowConfigResponseDTO();
            responseDTO.setType(type);
            responseDTO.setTitle(config.getTitle());
            responseDTO.setContent(config.getContent());
            responseDTO.setButtonText(config.getButtonText());
            responseDTO.setLink(config.getLink());
            responseDTO.setIsShow(config.getIsShow());
            responseDTO.setIconUrl(config.getIconUrl());
        }
        return responseDTO;
    }

}
